package com.wl.thread.demo04;

public class TestDaemon {
    public static void main(String[] args) {
        God god = new God();
        Person person = new Person();

        Thread godThread = new Thread(god);
        godThread.setDaemon(true);
        godThread.start();
        new Thread(person).start();
    }

}
class God implements Runnable{

    @Override
    public void run() {
        while (true){
            System.out.println("上帝守护");
        }
    }
}

class Person implements Runnable{

    @Override
    public void run() {
        for (int i = 0;i < 100;i++){
            System.out.println("被守护");
        }
        System.out.println("==goodbye world==");
    }
}
